﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace Studio
{
	// Token: 0x020005B7 RID: 1463
	public class OptionCtrl : MonoBehaviour
	{
		// Token: 0x0600253E RID: 9534 RVA: 0x000DCFEC File Offset: 0x000DB1EC
		public void UpdateUI()
		{
			this.sliderCameraX.value = Studio.optionSystem.cameraSpeedY;
			this.sliderCameraY.value = Studio.optionSystem.cameraSpeedX;
			this.sliderCameraSpeed.value = Studio.optionSystem.cameraSpeed;
			this.sliderSize.value = Studio.optionSystem.manipulateSize;
			this.sliderSpeed.value = Studio.optionSystem.manipuleteSpeed;
			this.toggleInitialPosition[0].isOn = (Studio.optionSystem.initialPosition == 0);
			this.toggleInitialPosition[1].isOn = (Studio.optionSystem.initialPosition == 1);
			this.toggleSelectedState[0].isOn = (Studio.optionSystem.selectedState == 0);
			this.toggleSelectedState[1].isOn = (Studio.optionSystem.selectedState == 1);
			this.toggleAutoHide[0].isOn = !Studio.optionSystem.autoHide;
			this.toggleAutoHide[1].isOn = Studio.optionSystem.autoHide;
			this.toggleAutoSelect[0].isOn = Studio.optionSystem.autoSelect;
			this.toggleAutoSelect[1].isOn = !Studio.optionSystem.autoSelect;
			for (int i = 0; i < this.toggleSnap.Length; i++)
			{
				this.toggleSnap[i].isOn = (Studio.optionSystem.snap == i);
			}
		}

		// Token: 0x0600253F RID: 9535 RVA: 0x000DD160 File Offset: 0x000DB360
		public void UpdateUIManipulateSize()
		{
			this.sliderSize.value = Studio.optionSystem.manipulateSize;
		}

		// Token: 0x06002540 RID: 9536 RVA: 0x000DD178 File Offset: 0x000DB378
		private void OnValueChangedSelectedState(int _state)
		{
			Studio.optionSystem.selectedState = _state;
			this.cameraControl.ReflectOption();
		}

		// Token: 0x06002541 RID: 9537 RVA: 0x000DD190 File Offset: 0x000DB390
		private void Start()
		{
			this.UpdateUI();
			this.sliderCameraX.onValueChanged.AddListener(delegate(float v)
			{
				Studio.optionSystem.cameraSpeedY = v;
				this.cameraControl.ReflectOption();
			});
			this.sliderCameraY.onValueChanged.AddListener(delegate(float v)
			{
				Studio.optionSystem.cameraSpeedX = v;
				this.cameraControl.ReflectOption();
			});
			this.sliderCameraSpeed.onValueChanged.AddListener(delegate(float v)
			{
				Studio.optionSystem.cameraSpeed = v;
				this.cameraControl.ReflectOption();
			});
			this.sliderSize.onValueChanged.AddListener(delegate(float v)
			{
				Studio.optionSystem.manipulateSize = v;
				Singleton<GuideObjectManager>.Instance.SetScale();
			});
			this.sliderSpeed.onValueChanged.AddListener(delegate(float v)
			{
				Studio.optionSystem.manipuleteSpeed = v;
			});
			this.toggleInitialPosition[0].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.initialPosition = 0;
			});
			this.toggleInitialPosition[1].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.initialPosition = 1;
			});
			this.toggleSelectedState[0].onValueChanged.AddListener(delegate(bool v)
			{
				this.OnValueChangedSelectedState(0);
			});
			this.toggleSelectedState[1].onValueChanged.AddListener(delegate(bool v)
			{
				this.OnValueChangedSelectedState(1);
			});
			this.toggleAutoHide[0].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.autoHide = !v;
			});
			this.toggleAutoHide[1].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.autoHide = v;
			});
			this.toggleAutoSelect[0].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.autoSelect = v;
			});
			this.toggleAutoSelect[1].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.autoSelect = !v;
			});
			this.toggleSnap[0].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.snap = 0;
			});
			this.toggleSnap[1].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.snap = 1;
			});
			this.toggleSnap[2].onValueChanged.AddListener(delegate(bool v)
			{
				Studio.optionSystem.snap = 2;
			});
		}

		// Token: 0x040025AE RID: 9646
		[SerializeField]
		private Slider sliderCameraX;

		// Token: 0x040025AF RID: 9647
		[SerializeField]
		private Slider sliderCameraY;

		// Token: 0x040025B0 RID: 9648
		[SerializeField]
		private Slider sliderCameraSpeed;

		// Token: 0x040025B1 RID: 9649
		[SerializeField]
		private Slider sliderSize;

		// Token: 0x040025B2 RID: 9650
		[SerializeField]
		private Slider sliderSpeed;

		// Token: 0x040025B3 RID: 9651
		[SerializeField]
		private Toggle[] toggleInitialPosition;

		// Token: 0x040025B4 RID: 9652
		[SerializeField]
		private Toggle[] toggleSelectedState;

		// Token: 0x040025B5 RID: 9653
		[SerializeField]
		private Toggle[] toggleAutoHide;

		// Token: 0x040025B6 RID: 9654
		[SerializeField]
		private Toggle[] toggleAutoSelect;

		// Token: 0x040025B7 RID: 9655
		[SerializeField]
		private Toggle[] toggleSnap;

		// Token: 0x040025B8 RID: 9656
		[SerializeField]
		private CameraControl cameraControl;
	}
}
